<?
include("core.php5/DB/ORM.class.php");
include("core.php5/DB/DataBase.class.php");
?>
<htm>
<title></title>
<head></head>
<body>
<?php 

if($_POST)
{


	$q="INSERT INTO contact VALUES (null, '".$_POST['name']."','".$_POST['email']."','".$_POST['phone']."','".htmlspecialchars($_POST['comments'])."', 0 , DATE_FORMAT(NOW(),'%Y-%m-%d') )";

	$res = DataBase::ExecuteNonQuery($q);
	if($res)
		echo '<div style="background-color:green;text-align:center;color:white"><b>Enviado correctamente</b></div> <script>get("select/noticias.php","content");</script>';
	else
		echo '<div style="background-color:red;text-align:center;color:white">Error al Enviar</div>';



}
else
{
	?>
<form method="post" action="" name="miform">
						 Escribenos:<br>
						 <table>
						 <tr>
						 	<td>Nombre:</td>
						 	<td><input type="text" value="" id="name" name="name" /></td>
						 </tr>
						 <tr>
						 	<td>Email:</td>
						 	<td><input type="text" value="" id="email" name="email" /></td>
						 </tr>
						 <tr>
						 	<td>Tel:</td>
						 	<td><input type="text" value="" id="phone" name="phone" /></td>
						 </tr>
						 <tr>
						 	<td colspan="2"><textarea cols='35' rows='4' id='comments' name='comments' ></textarea></td>
						 </tr>
						 <tr>
						 	<td colspan="2"><input type='button' onclick="post('comments.php?a=ins', 'mensajes','miform'); get('comments.php','formulario'); $('#mensajes').empty(); $('#mensajes').show(); desaparece('mensajes'); " id='envia' name='enviar' value='Enviar' />	</td>
						 </tr>
						 
  					</table>
												
						
						</form>
<?php } ?>						
</body>
</htm>